package com.shse.blog.service.impl;

import com.shse.blog.dao.BlogDao;
import com.shse.blog.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by shse on 3/13/2016.
 */
@Service
public class BlogServiceImpl implements BlogService{

    @Autowired
    private BlogDao blogDao;

    @Override
    public boolean addBlog(String blogTitle, String blogContent) {

        //若长度不符合要求，则不添加博文，返回false
        if(blogTitle.length()>20 || blogContent.length()>100){
            return false;
        }

        //长度符合要求的情况下进行数据持久化操作，返回true
        blogDao.addBlog(blogTitle, blogContent);
        return true;
    }
}
